package com.hctforgreen.greenservice.utils;

import android.content.Context;
import android.provider.Settings.Secure;
import android.telephony.TelephonyManager;
import android.util.Log;
/**
 * 获取机器码、IMEI码
 * @author 390694
 *
 */
public class MachineCodeUtil

{
	private Context context;

	public MachineCodeUtil(Context context) {
		super();
		this.context = context;
	}

	/**
	 * 
	 * @Title: getMachineCode
	 * @Description: TODO(获取机器码)
	 * @param @return 设定文件
	 * @return String 返回类型
	 * @throws
	 */
	public String getMachineCode() {

		String androidId = "";
		try {
			androidId = Secure.getString(context.getContentResolver(),
					Secure.ANDROID_ID);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return androidId;
	}

	/**
	 * 
	 * 
	 * @return
	 */
	public String getIMEICode() {
		try {
			String imme = "";

			TelephonyManager tm = (TelephonyManager) context
					.getSystemService(Context.TELEPHONY_SERVICE);
			imme = tm.getDeviceId();
			return imme;
		}catch(Exception e){
			e.printStackTrace();
			return "";
		}
	}
}
